Skip to content

fix(build): raise clear error if mkdocs.yml config file is missing #12378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RabbitAlbatross
Copy link

When the MkDocs configuration file is missing, the build currently fails with an "Unknown error" message. This change raises a clearer and more helpful BuildUserError if the mkdocs.yml file is not found, similar to how Sphinx errors are handled.

Closes #11937

@RabbitAlbatross RabbitAlbatross requested a review from a team as a code owner August 4, 2025 16:25
@RabbitAlbatross RabbitAlbatross requested a review from stsewd August 4, 2025 16:25
Comment on lines +104 to +108
if not os.path.exists(self.yaml_file):
raise BuildUserError(
f"MkDocs configuration file is missing — we could not find a 'mkdocs.yml' file at {self.yaml_file}. "
"Please make sure your repository includes one and try again."
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should follow the same approach we use for Sphinx. See an example at https://github.com/readthedocs/readthedocs.org/blob/main/readthedocs/doc_builder/backends/sphinx.py#L112-L113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build: "Unknown" error when mkdocs.yml is not found
2 participants